跳到主要内容

弹出软键盘

注:文章内容完全来自于这篇博客

[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);

[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
private void TspKeypad_Click(object sender, EventArgs e)
{
bool isKeyboadRunning = Process.GetProcessesByName("osk").Length > 0;
if (isKeyboadRunning) return;
IntPtr ptr = IntPtr.Zero;
bool redirected = Wow64DisableWow64FsRedirection(ref ptr);
try
{
Process.Start("osk.exe");
}
finally
{
if (redirected)
{
Wow64RevertWow64FsRedirection(ptr);
}
}
}